import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/home/Home.vue'
import NavBar from '../components/nav-bar'
import TabBar from '../components/tab-bar'

Vue.use(VueRouter)

const routes = [
  {
    path: '/home',
    name: 'Home',
    component: Home,
    components: { // 设置命名视图中渲染的关联组件
      header: NavBar,
      default: Home,
      footer: TabBar
    },
    meta: { // 路由元信息，用于存放开发过程中与当前路径相关的一些额外数据
      title: '首页',
      icon: '&#xe619;',
      inTabbar: true
    }
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
